package come.my.test;

public class day18 {
    public static void main(String[] args) {
       // Cat cat = new Cat(12,"白色","java",21.0);
        //System.out.println(cat.toString());

//        fiy fiy = new fiy(6);
//        fiy.leg();
//        fiy.fly();
//        fiy.reproduce();

//        Person01  person01 = new Teacher();
//        Teacher teacher=(Teacher)person01;
//        teacher.eat();
//        Person01  person02 = new Student01();
//        Student01 student01=(Student01)person02;
//        student01.eat();
//        Person01  person03 = new Doctor();
//        Doctor doctor=(Doctor)person03;
//        doctor.eat();

       Color []colors={new Red(),new Yellow(),new Blue()};
        for (int i = 0; i < colors.length; i++) {
            int index=(int)(Math.random()* colors.length);
            judge(colors[index]);
        }
    }
    public static void judge(Color color){
        if(color instanceof Red)
            System.out.print("红");
        if(color instanceof Yellow)
            System.out.print("黄");
        if(color instanceof Blue)
            System.out.print("蓝");
    }
}
/*class Cat{
    private String name;
    private int age;
    private double weight;
    private String color;

    public Cat(int age, String color, String name, double weight) {
        this.age = age;
        this.color = color;
        this.name = name;
        this.weight = weight;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getWeight() {
        return weight;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }

    @Override
    public String toString() {
        return "名字:"+getName()+"年龄:"+getAge()+"体重:"+getWeight()+"颜色:"+getColor();
    }
}*/
/*interface Flyable{
     void fly();
}
abstract class Insect{
    int legs;

    public Insect(int legs) {
        this.legs = legs;
    }
    public abstract void reproduce();
}
class fiy extends Insect implements Flyable{
    public fiy(int legs) {
        super(legs);
    }
    public void leg(){
        System.out.println("苍蝇有"+legs+"条腿");
    }
    @Override
    public void reproduce() {
        System.out.println("苍蝇的繁殖方式是产卵");
    }

    @Override
    public void fly(){
        System.out.println("苍蝇可以在空中飞");
    }
}*/

/* class Person01{
    public  void eat(){}
}
class Teacher extends Person01{
    @Override
     public void eat() {
      System.out.println("香辣肉丝");
    }
}
class Student01 extends Person01{
    @Override
    public void eat() {
        System.out.println("火腿炒面");
    }
}
class Doctor extends Person01{
    @Override
    public void eat() {
        System.out.println("麻辣香锅");
    }
}*/

class Color{}
class Red extends Color{}
class Yellow extends Color{}
class Blue extends Color{}